<template>
	<view>
			<!-- <card></card> -->
			<view class="block">
				<view class="frist">
					<view>{{getList.workName}}</view>
					<view class="red">{{getList.salary}}</view>
				</view>
				<view class="secend">
					<view>{{getList.cityName}}</view>
					<view>|</view>
					<view>{{getList.eduReq}}</view>
				</view>
				<!-- 标签 -->
				<view class="third">
					<view v-for="(item,index) in tags" :key="index">
						<view class="fenlei">{{item}}</view>
					</view>
				</view >
				<view class="gongsi">
					<image class="logo" :src="getList.companyIcon"></image>
					<view class="width">
						<view>{{getList.companyName}}</view>
						<view class="information">
							<view>{{getList.companyIntro}}</view>
						</view>
					</view>
					<image class="collection" src="../../static/shoucang-no.png" v-show="showUpImg" @click="changeImg" mode="heightFix"></image>
					<image class="collection" src="../../static/shoucang-y.png" v-show="!showUpImg" @click="changeImg" mode="heightFix"></image>
					<image class="collection1" src="../../static/fenxiang-n.png" mode="heightFix"></image>
				</view>
				
		</view>
		<!-- 复制区 -->
		<view class="fixed">
			<view class="one">
				<view>内推码 :</view>
				<view>{{getList.specialCode}}</view>
				<fuzhi @click.native="copy(getList.specialCode)"></fuzhi>
			</view>
			<view class="one">
				<view>联系人 :</view>
				<view>{{getList.specialPerson}}</view>
				<fuzhi @click.native="copy(getList.specialPerson)"></fuzhi>
			</view>
			<view class="one">
				<view>网申时间 :</view>
				<view class="color:red;">{{getList.applicationDate}}——{{getList.deadline}}</view>
				<text> </text>
			</view>
			<view class="one">
				<view>报名链接 :</view>
				<view class="lue">{{getList.url}}</view>
				<fuzhi @click.native="copy(getList.url)"></fuzhi>
			</view>
			<view class="one">
				<view>投递邮箱 :</view>
				<view>{{getList.email}}</view>
				<fuzhi @click.native="copy(getList.email)"></fuzhi>
			</view>
		</view>
		<!-- 职位描述 -->
		<view class="block">
			<view>招聘描述</view>
			<text class="content">{{getList.description}}</text>
		</view>
		<!-- 职位要求 -->
		<view class="block">
			<view>招聘要求</view>
			<text class="content">{{getList.requirement}}</text>
		</view>
		<!-- 其他 -->
		<view class="block bottom">
			<view>其他</view>
			<text class="content">{{getList.other}}</text>
		</view>
	</view>
</template>

<script>
	import card from"../../components/card.vue"
	import fuzhi from"../../components/fuzhi.vue"
	export default {
		components:{
			card,
			fuzhi,
		},
		data() {
			return {
				index:"",
				getList:[],
				tags:[],
				id:'',
				showUpImg:true,
			}
		},

		onLoad(e) {
			// 接受列表页传递过来的参数
			console.log(e);
			if(e.navIndex=="2"){
			//console.log('传递e.index',e.index);
			uni.request({
				url:"https://hotenergy.club/workapp/work/get_works",
				method:"GET",
				data:"",
				success:(res)=>{
					//console.log(res.data[e.index]);
					this.getList=res.data[e.index];
					this.tags=res.data.tags;
				},
			})}
			if(e.navIndex=='3'){
			//console.log('传递e',e);
			uni.request({
				url:"https://hotenergy.club/workapp/work/get_internships",
				method:"GET",
				data:"",
				success:(res)=>{
					//console.log(res.data);
					this.getList=res.data[e.index];
					this.tags=res.data.tags;
				},
			})}
			if(e.navIndex=='1'){
			//console.log('传递e',e.id);
			uni.request({
				url:"https://hotenergy.club/workapp/work/get_by_id/"+e.id,
				method:"GET",
				data:"",
				success:(res)=>{
					console.log('navIndex==1的res.data',res.data);
					this.getList=res.data;
					this.tags=res.data.tags;
				},
				})
			}
		},

		methods: {
			changeImg:function(){
				this.showUpImg = !this.showUpImg
			},
			copy(value){
				console.log(value)
				uni.setClipboardData({
					data:value,
					success:function(res){
						uni.getClipboardData()
					}
						
				})
			}
		}
	}
</script>

<style>
.block{
	position:relative;//定位方式,相对定位
	margin: 30rpx 25rpx 10rpx 25rpx;
	border-radius: 25rpx;
	border: 1px solid #e6e6e6;
	height:auto;
	padding: 3%;
	background-color: #FFFFFF;
}
.fixed{
	border-radius: 25rpx;
	border: 1px solid #e6e6e6;
	height:auto;
	position:relative;//定位方式,相对定位
	margin: 35rpx 25rpx 25rpx 25rpx;
	padding: 3%;
	font-size: small;
	font-weight: normal;
}
.one{
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	margin-bottom: 5rpx;
}
.lue{
	max-width:350rpx;
	text-overflow: ellipsis;//单行隐藏
	overflow: hidden;//
	white-space: nowrap;//
	font-size: small;
}
.content{
	margin-top: 8rpx;
	font-size: small;
	font-weight: normal;
}
.collection{
	margin-top: 10rpx ;
	height: 50rpx;
	/* margin: 20rpx 0 0 120rpx; */
}
.collection1{
	margin-top: 15rpx ;
	margin-left: 20rpx;
	height: 40rpx;
	/* margin: 20rpx 0 0 120rpx; */
}
.width{
	width: 65%;
}
.bottom{
	margin-bottom: 150rpx;
}
</style>
